//
//  EAGLView.h
//  XIEngine
//
//  Created by Bazsi on 22.05.09.
//  Copyright Universität Basel 2009. All rights reserved.
//


#import <UIKit/UIKit.h>

#import "XIEngine.h"
//#import <OpenGL/OpenGL.h>
//@class MyGame;

/*
This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass.
The view content is basically an EAGL surface you render your OpenGL scene into.
Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel.
*/

@interface EAGLView : UIView <XIRenderView> {
    
@private
    /* The pixel dimensions of the backbuffer */
    GLint backingWidth;
    GLint backingHeight;


	EAGLContext *context;
	
    /* OpenGL names for the renderbuffer and framebuffers used to render to this view */
    GLuint viewRenderbuffer, viewFramebuffer;
    
    /* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */
    GLuint depthRenderbuffer;
    
	
	//UILabel *fpsLabel;
	
	//NSMutableArray *fpsSample;
	//NSDate *fpsLastUpdate;
    //NSTimer *animationTimer;
    //NSTimeInterval animationInterval;

}

//@property NSTimeInterval animationInterval;

//- (void)startAnimation;
//- (void)stopAnimation;
//- (void)drawView;
- (void)prepareForNewFrame;
- (void)finalizeFrame;
//- (void)updateFPS;

//@property (nonatomic, retain) IBOutlet UILabel *fpsLabel;

@end
